<?php include_once ('function/check_login_function.php'); onlyValid(); onlyPatient();?>
<!DOCTYPE html>
<html>
<head>
	<title>Symptoms</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" type="text/css" href="">
</head>
<body>
	<div id="wrap">
		<header>
		</header>
		<div id="main">
			<div id="menu">
			</div>
			<div id="content">

				
				<?php if ($user->getRole() === 'patient') {?>
					<?php $symptom_list = $user->getSymptomList(); ?>
					<?php if ($symptom_list !== null) {?>
					<table>
					<tr>
					<th>Name</th>
					<th>Level</th>
					<th>Notes</th>
					<th>Date</th>
					<th></th>
					</tr>
					<?php 
						
							foreach ($symptom_list as $symptom) {
								echo '<tr>';
								echo '<td>' . $symptom['symptom_name'] . '</td>';
								echo '<td>' . $symptom['symptom_level'] . '</td>';
								echo '<td>' . $symptom['symptom_note'] . '</td>';
								echo '<td>' . $symptom['created_at'] . '</td>';
								echo '<td><a href="function/delete_symptom_function.php?id=' . $symptom['symptom_id'] . '">Delete</a></td>';
								echo '</tr>';
							}
						}
					?>
					<form action="function/enter_symptom_function.php" method="POST">				
					<label for="name">Symptom: </label>
					<input type="text" id="name" name="name" /> <br />
					<input type="radio" id="level" name="level" value="1" checked="checked"/> Mild :|
					<input type="radio" id="level" name="level" value="2"/> Average :( 
					<input type="radio" id="level" name="level" value="3"/> Severe X(<br />
					<label for="note"> Note: </label> <br />
					<textarea id="note" name="note" rows="4" cols="50"></textarea> <br />
					<input type="submit" name="enter" value="Enter" /> <br /> 
					</form>

				<?php } ?>
	
			</div>
		</div>
		<footer>
			<div id="footer">
				
			</div>
		</footer>
	</div>
</body>